/**
 * Copyright 2016-2017 TVI Go Easy.
 * Created on 2017/4/18 13:54
 */
package org.mechanic.fund.domain.product;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.mechanic.fund.domain.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 产品信息实体类
 *
 * @author mechanic
 * @version 0.0.1
 */
@Entity
@Table(name = "product")
public class Product extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 6711682386502698525L;

    /**
     * 父级编号
     */
    @Column(name = "parent_id")
    private String parentId;
    /**
     * 募集状态
     */
    @JsonIgnoreProperties(value = {"sort"})
    @ManyToOne
    @JoinColumn(name = "product_status_id", nullable = false)
    private ProductStatus productStatus;
    /**
     * 产品名称
     */
    @Column(name = "name", nullable = false)
    private String name;
    /**
     * 产品编码
     */
    @Column(name = "code")
    private String code;
    /**
     * 产品系列
     */
    @JsonIgnoreProperties(value = {"sort"})
    @ManyToOne
    @JoinColumn(name = "product_type_id", nullable = false)
    private ProductType productType;
    /**
     * 是否热销。0=否，1=是
     */
    @Column(name = "is_hot_selling", columnDefinition = "TINYINT(1)")
    private Integer isHotSelling;
    /**
     * 投资者风险等级关联产品风格类型（根据用户风格决定是否显示此产品）。0=不关联，1=关联
     */
    //@Column(name = "is_association")
    @Column(name = "is_association", columnDefinition = "TINYINT(1)")
    private Integer isAssociation;
    /**
     * 产品风格类型
     */
    @JsonIgnoreProperties(value = {"sort"})
    @ManyToOne
    @JoinColumn(name = "product_style_id")
    private ProductStyle productStyle;
    /**
     * 投资经理
     */
    @Column(name = "investment_manager")
    private String investmentManager;
    /**
     * 产品分级类型
     */
    @Column(name = "level")
    private String level;
    /**
     * 认购起点
     */
    @Column(name = "start_money")
    private String startMoney;
    /**
     * 管理人类型。1=管理人，2=投资顾问
     */
    @Column(name = "manager_type", columnDefinition = "TINYINT(1)")
    private Integer managerType;
    /**
     * 管理人名称
     */
    @Column(name = "manager_name")
    private String managerName;
    /**
     * 信托人类型。1=信托机构，2=信托受托人
     */
    @Column(name = "trustee_type", columnDefinition = "TINYINT(1)")
    private Integer trusteeType;
    /**
     * 信托人名称
     */
    @Column(name = "trustee_name")
    private String trusteeName;
    /**
     * 追加发行门槛
     */
    @Column(name = "conditions")
    private String conditions;
    /**
     * 发行开始日期
     */
    @Column(name = "issue_begin_date", columnDefinition = "TIMESTAMP")
    private LocalDate issueBeginDate;
    /**
     * 发行结束日期
     */
    @Column(name = "issue_end_date", columnDefinition = "TIMESTAMP")
    private LocalDate issueEndDate;
    /**
     * 成立日期
     */
    @Column(name = "register_date", columnDefinition = "TIMESTAMP")
    private LocalDate registerDate;
    /**
     * 币种
     */
    @Column(name = "currency")
    private String currency;
    /**
     * 封闭期
     */
    @Column(name = "close_period")
    private String closePeriod;
    /**
     * 产品期限
     */
    @Column(name = "expires")
    private String expires;
    /**
     * 推介起始日
     */
    @Column(name = "recommend_begin_date", columnDefinition = "TIMESTAMP")
    private LocalDate recommendBeginDate;
    /**
     * 推介终止日
     */
    @Column(name = "recommend_end_date", columnDefinition = "TIMESTAMP")
    private LocalDate recommendEndDate;
    /**
     * 赎回申请
     */
    @Column(name = "redemption")
    private String redemption;
    /**
     * 基准指数
     */
    @ManyToOne
    @JoinColumn(name = "product_stocks_index_type_id")
    @JsonIgnoreProperties(value = {"sort"})
    private ProductStocksIndexType productStocksIndexType;
    /**
     * 最新单位净值
     */
    @Column(name = "newest_netvalue")
    private BigDecimal newestNetvalue;
    /**
     * 最新累计净值
     */
    @Column(name = "newest_total_netvalue")
    private BigDecimal newestTotalNetvalue;
    /**
     * 最新净值日期
     */
    @Column(name = "netvalue_date", columnDefinition = "TIMESTAMP")
    private LocalDate netvalueDate;
    /**
     * 认购费
     */
    @Column(name = "buy_fee")
    private String buyFee;
    /**
     * 赎回费
     */
    @Column(name = "redemption_fee")
    private String redemptionFee;
    /**
     * 托管费
     */
    @Column(name = "trusteeship_fee")
    private String trusteeshipFee;
    /**
     * 浮动管理费
     */
    @Column(name = "float_fee")
    private String floatFee;
    /**
     * 其他费用
     */
    @Column(name = "other_fee")
    private String otherFee;
    /**
     * 其他费用
     */
    @Column(name = "fixed_fee")
    private String fixedFee;
    /**
     * 开放日期
     */
    @Column(name = "open_date")
    private String openDate;
    /**
     * 投资范围
     */
    @Column(name = "investment_scope")
    private String investmentScope;
    /**
     * 推荐理由
     */
    @Column(name = "recommend_reason")
    private String recommendReason;
    /**
     * 加入免责条款。0否，1是
     */
    @Column(name = "is_disclaimers", columnDefinition = "TINYINT(1)")
    private Integer isDisclaimers;
    /**
     * 备注
     */
    @Column(name = "remark")
    private String remark;

    public Product() {
    }

    public Product(
      String id,
      ProductStatus productStatus,
      String name,
      String code,
      ProductType productType,
      Integer isHotSelling,
      Integer isAssociation,
      ProductStyle productStyle,
      String investmentManager,
      String level,
      String startMoney,
      Integer managerType,
      String managerName,
      Integer trusteeType,
      String trusteeName,
      String conditions,
      LocalDate issueBeginDate,
      LocalDate issueEndDate,
      LocalDate registerDate,
      String currency,
      String closePeriod,
      String expires,
      LocalDate recommendBeginDate,
      LocalDate recommendEndDate,
      String redemption,
      ProductStocksIndexType productStocksIndexType,
      BigDecimal newestNetvalue,
      BigDecimal newestTotalNetvalue,
      LocalDate netvalueDate,
      String buyFee,
      String redemptionFee,
      String trusteeshipFee,
      String floatFee,
      String otherFee,
      String fixedFee,
      String openDate,
      String investmentScope,
      String recommendReason,
      Integer isDisclaimers,
      String remark,
      String createUser,
      LocalDateTime createTime,
      String updateUser,
      LocalDateTime updateTime) {
        this.productStatus = productStatus;
        this.name = name;
        this.code = code;
        this.productType = productType;
        this.isHotSelling = isHotSelling;
        this.isAssociation = isAssociation;
        this.productStyle = productStyle;
        this.investmentManager = investmentManager;
        this.level = level;
        this.startMoney = startMoney;
        this.managerType = managerType;
        this.managerName = managerName;
        this.trusteeType = trusteeType;
        this.trusteeName = trusteeName;
        this.conditions = conditions;
        this.issueBeginDate = issueBeginDate;
        this.issueEndDate = issueEndDate;
        this.registerDate = registerDate;
        this.currency = currency;
        this.closePeriod = closePeriod;
        this.expires = expires;
        this.recommendBeginDate = recommendBeginDate;
        this.recommendEndDate = recommendEndDate;
        this.redemption = redemption;
        this.productStocksIndexType = productStocksIndexType;
        this.newestNetvalue = newestNetvalue;
        this.newestTotalNetvalue = newestTotalNetvalue;
        this.netvalueDate = netvalueDate;
        this.buyFee = buyFee;
        this.redemptionFee = redemptionFee;
        this.trusteeshipFee = trusteeshipFee;
        this.floatFee = floatFee;
        this.otherFee = otherFee;
        this.fixedFee = fixedFee;
        this.openDate = openDate;
        this.investmentScope = investmentScope;
        this.recommendReason = recommendReason;
        this.isDisclaimers = isDisclaimers;
        this.remark = remark;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public ProductStatus getProductStatus() {
        return productStatus;
    }

    public void setProductStatus(ProductStatus productStatus) {
        this.productStatus = productStatus;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public ProductType getProductType() {
        return productType;
    }

    public void setProductType(ProductType productType) {
        this.productType = productType;
    }

    public Integer getIsHotSelling() {
        return isHotSelling;
    }

    public void setIsHotSelling(Integer isHotSelling) {
        this.isHotSelling = isHotSelling;
    }

    public Integer getIsAssociation() {
        return isAssociation;
    }

    public void setIsAssociation(Integer isAssociation) {
        this.isAssociation = isAssociation;
    }

    public ProductStyle getProductStyle() {
        return productStyle;
    }

    public void setProductStyle(ProductStyle productStyle) {
        this.productStyle = productStyle;
    }

    public String getInvestmentManager() {
        return investmentManager;
    }

    public void setInvestmentManager(String investmentManager) {
        this.investmentManager = investmentManager;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public String getStartMoney() {
        return startMoney;
    }

    public void setStartMoney(String startMoney) {
        this.startMoney = startMoney;
    }

    public Integer getManagerType() {
        return managerType;
    }

    public void setManagerType(Integer managerType) {
        this.managerType = managerType;
    }

    public String getManagerName() {
        return managerName;
    }

    public void setManagerName(String managerName) {
        this.managerName = managerName;
    }

    public Integer getTrusteeType() {
        return trusteeType;
    }

    public void setTrusteeType(Integer trusteeType) {
        this.trusteeType = trusteeType;
    }

    public String getTrusteeName() {
        return trusteeName;
    }

    public void setTrusteeName(String trusteeName) {
        this.trusteeName = trusteeName;
    }

    public String getConditions() {
        return conditions;
    }

    public void setConditions(String conditions) {
        this.conditions = conditions;
    }

    public LocalDate getIssueBeginDate() {
        return issueBeginDate;
    }

    public void setIssueBeginDate(LocalDate issueBeginDate) {
        this.issueBeginDate = issueBeginDate;
    }

    public LocalDate getIssueEndDate() {
        return issueEndDate;
    }

    public void setIssueEndDate(LocalDate issueEndDate) {
        this.issueEndDate = issueEndDate;
    }

    public LocalDate getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(LocalDate registerDate) {
        this.registerDate = registerDate;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public String getClosePeriod() {
        return closePeriod;
    }

    public void setClosePeriod(String closePeriod) {
        this.closePeriod = closePeriod;
    }

    public String getExpires() {
        return expires;
    }

    public void setExpires(String expires) {
        this.expires = expires;
    }

    public LocalDate getRecommendBeginDate() {
        return recommendBeginDate;
    }

    public void setRecommendBeginDate(LocalDate recommendBeginDate) {
        this.recommendBeginDate = recommendBeginDate;
    }

    public LocalDate getRecommendEndDate() {
        return recommendEndDate;
    }

    public void setRecommendEndDate(LocalDate recommendEndDate) {
        this.recommendEndDate = recommendEndDate;
    }

    public String getRedemption() {
        return redemption;
    }

    public void setRedemption(String redemption) {
        this.redemption = redemption;
    }

    public ProductStocksIndexType getProductStocksIndexType() {
        return productStocksIndexType;
    }

    public void setProductStocksIndexType(ProductStocksIndexType productStocksIndexType) {
        this.productStocksIndexType = productStocksIndexType;
    }

    public BigDecimal getNewestNetvalue() {
        return newestNetvalue;
    }

    public void setNewestNetvalue(BigDecimal newestNetvalue) {
        this.newestNetvalue = newestNetvalue;
    }

    public BigDecimal getNewestTotalNetvalue() {
        return newestTotalNetvalue;
    }

    public void setNewestTotalNetvalue(BigDecimal newestTotalNetvalue) {
        this.newestTotalNetvalue = newestTotalNetvalue;
    }

    public LocalDate getNetvalueDate() {
        return netvalueDate;
    }

    public void setNetvalueDate(LocalDate netvalueDate) {
        this.netvalueDate = netvalueDate;
    }

    public String getBuyFee() {
        return buyFee;
    }

    public void setBuyFee(String buyFee) {
        this.buyFee = buyFee;
    }

    public String getRedemptionFee() {
        return redemptionFee;
    }

    public void setRedemptionFee(String redemptionFee) {
        this.redemptionFee = redemptionFee;
    }

    public String getTrusteeshipFee() {
        return trusteeshipFee;
    }

    public void setTrusteeshipFee(String trusteeshipFee) {
        this.trusteeshipFee = trusteeshipFee;
    }

    public String getFloatFee() {
        return floatFee;
    }

    public void setFloatFee(String floatFee) {
        this.floatFee = floatFee;
    }

    public String getOtherFee() {
        return otherFee;
    }

    public void setOtherFee(String otherFee) {
        this.otherFee = otherFee;
    }

    public String getFixedFee() {
        return fixedFee;
    }

    public void setFixedFee(String fixedFee) {
        this.fixedFee = fixedFee;
    }

    public String getOpenDate() {
        return openDate;
    }

    public void setOpenDate(String openDate) {
        this.openDate = openDate;
    }

    public String getInvestmentScope() {
        return investmentScope;
    }

    public void setInvestmentScope(String investmentScope) {
        this.investmentScope = investmentScope;
    }

    public String getRecommendReason() {
        return recommendReason;
    }

    public void setRecommendReason(String recommendReason) {
        this.recommendReason = recommendReason;
    }

    public Integer getIsDisclaimers() {
        return isDisclaimers;
    }

    public void setIsDisclaimers(Integer isDisclaimers) {
        this.isDisclaimers = isDisclaimers;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}

